//
//  ExampleViewController.m
//  MasonryExample
//
//  Created by 山刘 on 2020/6/9.
//  Copyright © 2020 山刘. All rights reserved.
//

#import "ExampleViewController.h"

@interface ExampleViewController ()
@property (nonatomic, strong) Class viewClass;
@property (nonatomic, strong) UIView *subView;
@end

@implementation ExampleViewController

- (id)initWithTitle:(NSString *)title viewClass:(Class)viewClass subView:(Class)subView {
    self = [super init];
    if (!self) return nil;
    
    self.title = title;
    self.subView = subView.new;
    self.viewClass = viewClass;
    
    self.view.backgroundColor = [UIColor lightGrayColor];
    self.subView.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:self.subView];
    [self.subView makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(200, 400));
    }];
     return self;
}

- (id)initWithTitle:(NSString *)title viewClass:(Class)viewClass {
    self = [super init];
    if (!self) return nil;
    
    self.title = title;
    self.viewClass = viewClass;
    
    return self;
}

- (void)loadView {
    self.view = self.viewClass.new;
    self.view.backgroundColor = [UIColor whiteColor];
}
#ifdef __IPHONE_7_0
- (UIRectEdge)edgesForExtendedLayout {
    return UIRectEdgeNone;
}
#endif
@end
